ARCH := arm
CROSS_COMPILE := arm-linux-gnueabihf-
KERNELDIR := /home/yushuang/nxplinux/linux-net
CURRENT_PATH := $(shell pwd)

obj-m := gpioled.o

# Application target
APP_NAME := ledApp

build: kernel_modules app

kernel_modules:
	$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules

app:
	$(CROSS_COMPILE)gcc -o $(APP_NAME) $(APP_NAME).c

clean:
	$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
	rm -f $(APP_NAME)
